<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
  </head>

  <body>
    <p>
      <label>
        <input type="checkbox" id="checkbox" />
        use max power
      </label>
      <br />
      Power:
      <span id="power">10</span>
      %
    </p>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script src="./9/jquery.animateNumber.min.js"></script>
    <script type="text/javascript">
      var numberStep = function (now, tween) {
        var target = $(tween.elem),
          rounded_now = Math.round(now)

        target.prop('number', rounded_now).text(rounded_now)
      }

      var use_max_power = $('#checkbox')
      use_max_power.click(function () {
        if (use_max_power.is(':checked')) {
          $('#power').stop().animateNumber(
            {
              // stop() animation
              number: 100,
              numberStep: numberStep,
            },
            5000
          )
        } else {
          $('#power').stop().animateNumber(
            {
              number: 10,
              numberStep: numberStep,
            },
            5000
          )
        }
      })
    </script>
  </body>
</html>
